let productid=getQueryString('productid')
let info = document.querySelector('.info')
let submit=document.querySelector('.submit')
console.log(info)
console.log(productid);


fetch(`http://chst.vip:1234/api/getdiscountproduct?productid=${productid}`)
    .then(body => body.json())
    .then(res => {
        console.log(res)
        let el = '';
        let str='';
        res.result.forEach(item => {
            // console.log(item)
            // let regExp = /(?<=imgurl=)[^'"]*/
            // let result = item.productImg2.match(regExp)
            
            el+=`<li>
            <div class="in">
                <h4 class="title">${item.productName}</h4>
                <div class="other">
                    <span>${item.productFrom}${item.productTime}</span>
                    <i>${item.productTips}</i>
                    <div>${item.productPrice}</div>
                </div>
                <div class="container">
                    <div class="txt">${item.productInfo}</div>
                    <p>
                        ${item.productImg}
                    </p>
                </div>
            </div>
        </li>`
        console.log(el)

            str+=`${item.productComment}`
            info.innerHTML=el;
            submit.innerHTML=str
        })

    })

    // 返回顶部
let toTop = $('.gotop').get(0)
// console.log(toTop)

toTop.onclick = function (e) {
  console.log(123)
  document.documentElement.scrollTop = 0;
}